var tree;
function syncMC() {
    var menu = document.getElementById("menu");
    var lbar = document.getElementById("lbar");
    var mcon = menu.children[0];
    var content = document.getElementById("content");
    var left = mcon.offsetWidth + parseInt(lbar.style.left);
    content.style.left = left + "px";
    content.style.width = (parseInt(document.body.offsetWidth) - left) + "px";
}

function clickNode(id) {
    var url = document.location.href;
    url = url.split("#")[0];
    document.location.href = url + "#" + id;
    syncMC();
}

window.onload = function() {
    tree = new dhtmlXTreeFromHTML("menu");
    tree.setOnClickHandler(clickNode);
    tree.attachEvent("onOpenEnd", function(id, state) {
        syncMC();
    });
    tree.attachEvent("onXLE", function(tree, id) {
        syncMC();
    });
}